#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
const int N = 1e6 + 5;

void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a > c) && (b < d) || (a < c) && (d < b))
        cout << "A" << endl;
    else if ((b < c) || (a > d))
        cout << "B" << endl;
    else
        cout << "C" << endl;
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin >> t;
    while (t--) solve();

    return 0;
}